import store from "../../store";
import axios from "axios";
import getUrlSearch from '../../utils/getUrlSearch';
// import {getHrefParams} from '../zx/index';
// store.commit()
export const getUserInfo = () => {
    let sessionId = getUrlSearch().sessionId;
    console.log(store,'store');
    return new Promise(resolve => {
        if (!sessionId) resolve(); 
        let url = window.api.customer_host + '/customer/getCustomer' + `?token=${new Date().getTime()}`;
        let config = {
            url,
            method:'get',
            headers:{sessionId}
        }
        console.log(9999999999999)
        axios(config).then((res) => {
            if(res.data.returnCode == 1){
                store.commit('wxh/RECORD_SESSIONID',sessionId);
                store.commit('wxh/USER_INFO',res.data.data[0]);
            }
            resolve();
        }).catch(err => {
            console.log("getUserInfo", err);
            resolve();
        });
    });
    
}